import Mock from 'mockjs';
const count = 100;

let memberTableList = [];
let couponTypeList = [];
let cashbackDetailedManageList = [];// 返现金额明细
let couponDetailList = [];
for (let i = 0; i < count; i++) {
    memberTableList.push(Mock.mock({
        'uuid': '@increment()', // 必须项
        memberId: 'm0000001',
        kehu: '@cname',
        'activityAmount': '1000',
        address: '@province @city @county',
        'qycard|1': ['10', '20', '30'],
        'point|+1': 12121,
        czmoney: '@increment(1)',
        buyNum: 345,
        xfMoney: '订单满89元',
        'releaseState|1': ['未发布', '已发布'],
        'startTime': '@date(yyyy-MM-dd)', // 开始时间
        'endTime': '@date(yyyy-MM-dd)', // 结束时间
        releaseTime: '@date(yyyy-MM-dd)', // data选择范围是 是数组形式 如：['2019-12-13,2019-12-13]
        'brandLogo|1': [ // 默认列表 同iview组件的 defaultList
            [{
                name: '小头1', // 图片name
                url: 'https://dev-file.iviewui.com/BbnuuEiM0QXNPHVCvb3E2AFrawIjCkqW/avatar' // 图片url
            }],
            [{
                name: '小头像', // 图片name
                url: 'https://dev-file.iviewui.com/userinforaP8NeQgYpmKgkpWlqZP7rfewbHiIzJY/avatar' // 图片url
            }]
        ],
        'area|1': [
            ['beijing', 'tiantan']
        ],
        'isRelease|1': ['0', '1'],
        'relationShops|1': [
            ['0', '1'],
            ['0', '2'],
            ['0', '3'],
            ['1', '2'],
            ['1', '3'],
            ['2', '3']
        ],
        'descInfo|10-20': '@cname',
        'actions|1': [

            [
                {
                    name: 'View',
                    label: '查看',
                    handleType: 'link'
                }, {
                    name: 'Edit',
                    label: '编辑',
                    handleType: 'link'
                }, {
                    name: 'show',
                    label: '发布',
                    handleType: 'alert'
                }, {
                    name: 'cancleShow',
                    label: '取消发布',
                    handleType: 'alert'
                }
            ]
        ]
    }))
    cashbackDetailedManageList.push(Mock.mock({
        'uuid': '@increment()', // 必须项\
        'name': '@word',
        'aMoney': '1000',
        'customer': '@cname',
        'customerNo': '1000' + i,
        'orderrNo': 'ORDER10000' + i,
        'money': '1000',
        'use': '100',
        'state|1': ['待到账', '已到账'],
        'returnTime': '@date(yyyy-MM-dd)',
        'createOpeTime': '@date(yyyy-MM-dd)',
        'actions|1': [
            [
                {
                    name: 'View',
                    label: '查看',
                    handleType: 'link'
                }
            ]
        ]
    }))
    couponTypeList.push(Mock.mock({
        'uuid': '@increment()', // 必须项\
        'name': '@word',
        'money': '1000',
        'xnum': '1',
        'num': '10',
        'lnum': '10',
        'area': '满100元',
        'orderrNo': 'ORDER10000' + i,
        'use': '100',
        'state|1': ['待到账', '已到账'],
        'startTime': '@date(yyyy-MM-dd)',
        'endTime': '@date(yyyy-MM-dd)',
        'creatOpeTime': '@date(yyyy-MM-dd)',
        'actions|1': [
            [
                {
                    name: 'View',
                    label: '查看',
                    handleType: 'link'
                }
            ]
        ]
    }))
    couponDetailList.push(Mock.mock({
        'uuid': '@increment()', // 必须项\
        'no': '1000' + i,
        'isOpen|1': ['是', '否'],
        'userName': '@cname',
        'name': '@word',
        'money': '1000',
        'xnum': '1',
        'num': '10',
        'xlnum': '10',
        'area': '满100元',
        'orderrNo': 'ORDER10000' + i,
        'use': '100',
        'state|1': ['待到账', '已到账'],
        'startTime': '@date(yyyy-MM-dd)',
        'endTime': '@date(yyyy-MM-dd)',
        'creatOpeTime': '@date(yyyy-MM-dd)',
        'actions|1': [
            [
                {
                    name: 'View',
                    label: '查看',
                    handleType: 'link'
                }
            ]
        ]
    }))
}

export default [
    {
        path: '/api/getMarketingMoneyList',
        method: 'get',
        handle ({ body }) {
            const start = body.pageInfo.nowPage * body.pageInfo.pageShow - body.pageInfo.pageShow;
            const end = start + body.pageInfo.pageShow;
            let data = {
                return_code: 0,
                list: [...memberTableList].slice(start, end),
                pageInfo: {
                    nowPage: 1, // 当前页数
                    pageShow: body.pageInfo.pageShow, // 每页显示条数
                    totalPage: count / body.pageInfo.pageShow, // 总页数
                    totalNum: count // 总条数
                }
            }
            if (body.pageInfo.nowPage) {
                return {
                    code: 0,
                    msg: '获取数据成功',
                    data: data
                }
            } else {
                return {
                    code: 401,
                    msg: '接口请求超时',
                    data: {}
                }
            }
        }
    },
    {
        path: '/api/getActivityEdit',
        method: 'get',
        handle ({ body }) {
            if (body.uuid) {
                let memberInfo = {};
                for (let i = 0; i < memberTableList.length; i++) {
                    if (Number(body.uuid) === memberTableList[i].uuid) {
                        memberInfo = memberTableList[i];
                        break;
                    }
                }
                return {
                    code: 0,
                    msg: '',
                    data: {
                        data: memberInfo,
                        return_code: 0
                    }
                }
            } else {
                return {
                    code: 401,
                    msg: '接口请求超时',
                    data: {}
                }
            }
        }
    },
    {
        path: '/api/delMemberInfo',
        method: 'get',
        handle ({ body }) {
            if (body.uuid) {
                return {
                    code: 0,
                    msg: '删除数据成功',
                    data: {
                        return_code: 0
                    }
                }
            } else {
                return {
                    code: 401,
                    msg: '接口请求超时',
                    data: {}
                }
            }
        }
    },
    {
        path: '/api/getMarketingActiveList',
        method: 'get',
        handle ({ body }) {
            const start = body.pageInfo.nowPage * body.pageInfo.pageShow - body.pageInfo.pageShow;
            const end = start + body.pageInfo.pageShow;
            let data = {
                return_code: 0,
                list: [...memberTableList].slice(start, end),
                pageInfo: {
                    nowPage: 1, // 当前页数
                    pageShow: body.pageInfo.pageShow, // 每页显示条数
                    totalPage: count / body.pageInfo.pageShow, // 总页数
                    totalNum: count // 总条数
                }
            }
            if (body.pageInfo.nowPage) {
                return {
                    code: 0,
                    msg: '获取数据成功',
                    data: data
                }
            } else {
                return {
                    code: 401,
                    msg: '接口请求超时',
                    data: {}
                }
            }
        }
    },
    {
        path: '/api/getCouponTypeList',
        method: 'get',
        handle ({ body }) {
            const start = body.pageInfo.nowPage * body.pageInfo.pageShow - body.pageInfo.pageShow;
            const end = start + body.pageInfo.pageShow;
            let data = {
                return_code: 0,
                list: [...couponTypeList].slice(start, end),
                pageInfo: {
                    nowPage: 1, // 当前页数
                    pageShow: body.pageInfo.pageShow, // 每页显示条数
                    totalPage: count / body.pageInfo.pageShow, // 总页数
                    totalNum: count // 总条数
                }
            }
            if (body.pageInfo.nowPage) {
                return {
                    code: 0,
                    msg: '获取数据成功',
                    data: data
                }
            } else {
                return {
                    code: 401,
                    msg: '接口请求超时',
                    data: {}
                }
            }
        }
    },
    {
        path: '/api/getCouponDetailList',
        method: 'get',
        handle ({ body }) {
            const start = body.pageInfo.nowPage * body.pageInfo.pageShow - body.pageInfo.pageShow;
            const end = start + body.pageInfo.pageShow;
            let data = {
                return_code: 0,
                list: [...couponDetailList].slice(start, end),
                pageInfo: {
                    nowPage: 1, // 当前页数
                    pageShow: body.pageInfo.pageShow, // 每页显示条数
                    totalPage: count / body.pageInfo.pageShow, // 总页数
                    totalNum: count // 总条数
                }
            }
            if (body.pageInfo.nowPage) {
                return {
                    code: 0,
                    msg: '获取数据成功',
                    data: data
                }
            } else {
                return {
                    code: 401,
                    msg: '接口请求超时',
                    data: {}
                }
            }
        }
    },
    {
        path: '/api/getCashbackDetailedManageList',
        method: 'get',
        handle ({ body }) {
            const start = body.pageInfo.nowPage * body.pageInfo.pageShow - body.pageInfo.pageShow;
            const end = start + body.pageInfo.pageShow;
            let data = {
                return_code: 0,
                list: [...cashbackDetailedManageList].slice(start, end),
                pageInfo: {
                    nowPage: 1, // 当前页数
                    pageShow: body.pageInfo.pageShow, // 每页显示条数
                    totalPage: count / body.pageInfo.pageShow, // 总页数
                    totalNum: count // 总条数
                }
            }
            if (body.pageInfo.nowPage) {
                return {
                    code: 0,
                    msg: '获取数据成功',
                    data: data
                }
            } else {
                return {
                    code: 401,
                    msg: '接口请求超时',
                    data: {}
                }
            }
        }
    }, {
        path: '/api/getCashbackDetailedManage',
        method: 'get',
        handle ({ body }) {
            if (body.uuid) {
                let memberInfo = {};
                for (let i = 0; i < cashbackDetailedManageList.length; i++) {
                    if (Number(body.uuid) === cashbackDetailedManageList[i].uuid) {
                        memberInfo = cashbackDetailedManageList[i];
                        break;
                    }
                }
                return {
                    code: 0,
                    msg: '',
                    data: {
                        data: memberInfo,
                        return_code: 0
                    }
                }
            } else {
                return {
                    code: 401,
                    msg: '接口请求超时',
                    data: {}
                }
            }
        }
    }, {
        path: '/api/getReturnActivity',
        method: 'get',
        handle ({ body }) {
            if (body.uuid) {
                let memberInfo = {};
                for (let i = 0; i < memberTableList.length; i++) {
                    if (Number(body.uuid) === memberTableList[i].uuid) {
                        memberInfo = memberTableList[i];
                        break;
                    }
                }
                return {
                    code: 0,
                    msg: '',
                    data: {
                        data: memberInfo,
                        return_code: 0
                    }
                }
            } else {
                return {
                    code: 401,
                    msg: '接口请求超时',
                    data: {}
                }
            }
        }
    }, {
        path: '/api/getCouponType',
        method: 'get',
        handle ({ body }) {
            if (body.uuid) {
                let memberInfo = {};
                for (let i = 0; i < couponTypeList.length; i++) {
                    if (Number(body.uuid) === couponTypeList[i].uuid) {
                        memberInfo = couponTypeList[i];
                        break;
                    }
                }
                return {
                    code: 0,
                    msg: '',
                    data: {
                        data: memberInfo,
                        return_code: 0
                    }
                }
            } else {
                return {
                    code: 401,
                    msg: '接口请求超时',
                    data: {}
                }
            }
        }
    }, {
        path: '/api/getCouponDetail',
        method: 'get',
        handle ({ body }) {
            if (body.uuid) {
                let memberInfo = {};
                for (let i = 0; i < couponDetailList.length; i++) {
                    if (Number(body.uuid) === couponDetailList[i].uuid) {
                        memberInfo = couponDetailList[i];
                        break;
                    }
                }
                return {
                    code: 0,
                    msg: '',
                    data: {
                        data: memberInfo,
                        return_code: 0
                    }
                }
            } else {
                return {
                    code: 401,
                    msg: '接口请求超时',
                    data: {}
                }
            }
        }
    }
]
